#!/user/bin/env python
# -*- coding:utf8 -*-

from flask_wtf import FlaskForm
from wtforms import IntegerField,StringField,TextAreaField,PasswordField,BooleanField,SelectField,ValidationError,HiddenField,SubmitField
#from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import Required,Length,Email,Regexp,EqualTo,URL,Optional
from flask_login import current_user
from .models import Category 

class ItemEditForm(FlaskForm):
    title = StringField("Title",validators=[Required()])
    content = TextAreaField("Content",validators=[Required()])
    #category_id = QuerySelectField("Category",validators=[Required()],queryset=Category.query.all())
    category_id = SelectField("Category",validators=[Required()],coerce=int)
    readme = StringField("Details")
    submit = SubmitField('Submit')

class TagEditForm(FlaskForm):
    name = StringField("TagName",validators=[Required()])
    content = TextAreaField("Tag Content")
    status = BooleanField("Disabled")
    submit = SubmitField('Submit')

class TagUrlEditForm(FlaskForm):
    title = StringField("Url Title",validators=[Required()])
    url = StringField("Link",validators=[Required(),URL()],render_kw={"placeholder":"https://www.google.com"})
    submit = SubmitField('Submit')
